package com.clinic.entity.db;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

@Entity
@Table(name = UserLogin.TABLE)
public class UserLogin implements Serializable{
	
	private static final long serialVersionUID = -6734960558598124227L;

	public static final String TABLE = "userlogin";
	
	public static final class Columns {
		public static final String LOGIN_ID = "loginId";
		public static final String USERNAME = "username";
		public static final String PASSWORD = "password";
		public static final String USER_ID = "userId";
	}
	
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = Columns.LOGIN_ID)
	private long loginId;
	
	@Column(name = Columns.USERNAME)
	private String username;
	
	@Column(name = Columns.PASSWORD)
	private String password;
	
	@OneToOne(cascade=CascadeType.ALL, fetch = FetchType.LAZY)
	@JoinColumn(name = Columns.USER_ID)
	private User user;

	public long getLoginId() {
		return loginId;
	}

	public void setLoginId(long loginId) {
		this.loginId = loginId;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

}
